project(Thesis-application)
cmake_minimum_required(VERSION 2.6)
SET( APP_VERSION_MAJOR "0" )
SET( APP_VERSION_MINOR "1" )
SET( APP_VERSION_PATCH "0" )

set( CMAKE_MODULE_PATH    ${CMAKE_MODULE_PATH}
                          ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules )
find_package(Qt4 REQUIRED)
find_package(Boost REQUIRED )
find_package(Qwt5 REQUIRED)
include_directories("3rdParty")
add_subdirectory(3rdParty/muparser)
add_subdirectory(3rdParty/QtWindowListMenu)
#add_subdirectory(src)
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${Qwt5_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
set(THESIS_SRCS  
src/main.cpp
src/mainwindow.cpp
src/UI/actions.cpp
src/UI/menus.cpp
src/UI/functionwidget.cpp
src/UI/functionedit.cpp
src/UI/functionplot.cpp
src/UI/stylesheets.cpp
src/math/function.cpp
src/math/ifunction.cpp
src/math/parserfactory.cpp
src/Common/settings.cpp
)
set(THESIS_HDRS
src/mainwindow.h
src/UI/actions.h
src/UI/menus.h
src/UI/functionwidget.h
src/UI/functionplot.h
src/UI/functionedit.h
src/UI/stylesheets.h
src/math/function.h
src/math/ifunction.h
src/math/parserfactory.h
src/Common/settings.h
)
qt4_automoc(${THESIS_SRCS})
qt4_wrap_cpp( THESIS_MOC src/mainwindow.h src/UI/functionwidget.h src/UI/functionedit.h src/UI/functionplot.h) 
INCLUDE(${QT_USE_FILE})
add_executable(thesis ${THESIS_SRCS} ${THESIS_MOC} )
target_link_libraries(thesis ${QT_LIBRARIES} ${Qwt5_Qt4_LIBRARY} muparser qtwindowlistmenu)

if( WIN32 )
Find_File(qtgui QtGui4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtcore QtCore4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtmain qtmain.lib PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtnetwork qtnetwork4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qwt qwt.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
INSTALL(FILES ${qtgui} ${qtcore} ${qtmain} ${qtnetwork} DESTINATION bin )
ENDIF( WIN32 )

INSTALL(TARGETS thesis
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
)


INCLUDE(InstallRequiredSystemLibraries)
set(CPACK_BINARY_ZIP ON)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "My Thesis. Subject is: ")
SET(CPACK_PACKAGE_VENDOR "Bartosz Taczala")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/GPL.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR ${APP_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${APP_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${APP_VERSION_PATCH})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Thesis")
IF(WIN32 AND NOT UNIX)
SET(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_INSTALL_DIRECTORY} "QWhatToDo")
SET(CPACK_NSIS_CONTACT "btaczala@wips.pl")
ENDIF(WIN32 AND NOT UNIX)
INCLUDE(CPack)